<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function ramdom(min, max) {
        /* 
          (0,1)*9=(0,9)
          (0,1)+2=(2,3)
          (0,1)*9=(0,9)+2=(2,11)
          min=2
          max=11
          (0,1)*9+2=(2,11)
          (0,1)*(max-min)+min
        */
        const r = Math.random() * (max - min) + min;
        return Math.round(r);
      }
      console.log(ramdom(3, 5));
    </script>
  </body>
</html>
